<template>
	<!-- 设施信息 -->
	<view>
		<view class="title">
			<view class="left">住户信息</view>
			<view class="right">
				<!-- <text class="add" @click="goScan">
					+
				</text>
				<text @click="onAdd" style="color: #5094FF;">新增住户</text> -->
			</view>
		</view>
		<view class="info">
			<view v-if="residentList.length !== 0">
				<view class="info-item" v-for="item in residentList" :key="item.id">
					<view>
						<view class="info-wrap">姓名：{{item['姓名'] | nameHide}}</view>
						<view class="info-wrap">电话：{{item['手机号'] | phoneHide}}</view>
						<view class="info-wrap">证件编号：{{item['证件编号'] | idNumHide}}</view>
						<view class="info-wrap">与户主关系：{{residentTypeObj[item['户主关系']]}}</view>
					</view>
					<!-- <view class="arrow"></view> -->
				</view>
			</view>
			<view v-else class="empty">暂无住户</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			residentList: {
				type: Array,
				default: () => []
			}
		},
		// props: ['residentList'],
		data() {
			return {
				residentTypeObj: this.$type.residentTypeObj
			}
		},
		methods: {
		},
		filters: {
			nameHide(val) {
				return val.slice(0,1) + '*'.repeat(val.length-1)
			},
			phoneHide(val) {
				return val.slice(0,4) + '****'+ val.slice(8)
			},
			idNumHide(val) {
				return val.slice(0,8) + '******' + val.slice(14)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.title {
		padding: 0 14rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 40rpx;
		font-size: 34rpx;

		.left {
			font-size: 32rpx;

			&:before {
				content: '';
				position: absolute;
				top: 24rpx;
				left: 24rpx;
				width: 6rpx;
				height: 34rpx;
				background-color: #5094FF;
			}
		}

		.add {
			font-size: 32rpx;
			font-weight: bold;
			color: #5094FF;
			margin-right: 10rpx;
		}
	}

	.info {
		margin-left: 16rpx;
		font-size: 28rpx;

		// display: flex;
		// justify-content: center;
		// align-items: center;
		.empty {
			// width: 100%;
			display: flex;
			align-items: center;
			justify-content: center;
			height: 174rpx;
			color: #999;
		}

		.info-item {
			position: relative;
			margin-bottom: 10rpx;
			box-shadow: 0px 1px 6rpx 0px #EEEEEE;

			// border-bottom: 2rpx solid #eee;
			.info-title {
				margin-bottom: 20rpx;
			}

			.info-wrap {
				line-height: 50rpx;
			}

			.arrow {
				position: absolute;
				top: 100rpx;
				right: 40rpx;
				width: 20rpx;
				height: 20rpx;
				border-top: 2rpx solid #333;
				border-right: 2rpx solid #333;
				transform: rotate(45deg);
			}

			.delete {
				position: absolute;
				right: 20rpx;
				bottom: 10rpx;
				text-align: center;
				line-height: 35rpx;
				width: 70rpx;
				height: 35rpx;
				font-size: 22rpx;
				color: #E57544;
				border: 2rpx solid #E57544;
			}
		}
	}
</style>
